#ifndef prs_FrmGeom_H
#define prs_FrmGeom_H

#include "prs_FrmNodes.h"
#include "prs_FrmGeomSize.h"
#include "prs_FrmGeomAlign.h"
#include "prs_FrmGeomDirect.h"
#include "prs_FrmGeomBorder.h"
#include "sntText.h"

namespace prs {

///////////////////////////////////////////////////////////////////////////////

struct TNodeFrmGeom : public TNodeFrm
{
  DECLARE_ClientNode()

/*******************
  enum EOrdinate { 
    EOrdinate_X = 0,
    EOrdinate_Y = 1 
  };
*******************/

  //
  TAttrPointerNodeOwner<attrName_Width ,TNodeFrmGeomSize*> Width;
  TAttrPointerNodeOwner<attrName_Height,TNodeFrmGeomSize*> Height;
  //
  TAttrPointerNodeOwner<attrName_WAlign,TNodeFrmGeomAlign*> WAlign;
  TAttrPointerNodeOwner<attrName_HAlign,TNodeFrmGeomAlign*> HAlign;
  //
  TAttrPointerNodeOwner<attrName_Direct,TNodeFrmGeomDirect*> Direct;
  TAttrPointerNodeOwner<attrName_Border,TNodeFrmGeomBorder*> Border;
  //
  TNodeFrmGeom() : Width(this),Height(this),WAlign(this),HAlign(this),Direct(this),Border(this) {}
  //void operator = (const TNodeGeom &From) { CopyAttrFrom(&From);}
  //
  //void SetSize       (EOrdinate Ordinate,TNodeFrmGeomSize &Value);
  //void SetSizeByName (EOrdinate Ordinate,svl::TString &Name);
  //void SetAlignByName(EOrdinate Ordinate,svl::TString &Name);
  //
  void UnionWAlignTo(frm::geometry::TGeometry &To);
  void UnionHAlignTo(frm::geometry::TGeometry &To);
  void UnionWidthTo (frm::geometry::TGeometry &To);
  void UnionHeightTo(frm::geometry::TGeometry &To);
  void UnionDirectTo(frm::geometry::TGeometry &To);
  void UnionBorderTo(frm::geometry::TGeometry &To);
  //
  void UnionTo(frm::geometry::TGeometry &To);
};
                       
///////////////////////////////////////////////////////////////////////////////

struct TRuleFrmGeom : public snt::TRule
{
  TRuleFrmGeomSize   RGeomSize;
  TRuleFrmGeomDirect RGeomDirect;
  TRuleFrmGeomAlign  RGeomAlign;
  //
  TRuleFrmGeom(
    snt::text::TContext &SntContext
  );
  //
  void SetGeom(TNodeFrmGeom *V) { geom = V;}

private:  
  void FSetAttrWidth (snt::TParams &Params);
  void FSetAttrHeight(snt::TParams &Params);
  void FSetAttrDirect(snt::TParams &Params);
  void FSetAttrWAlign(snt::TParams &Params);
  void FSetAttrHAlign(snt::TParams &Params);
  //
  TNodeFrmGeom *geom;
  svl_Except;
};

///////////////////////////////////////////////////////////////////////////////
}

#endif
